package com.net.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="sell_back_detail")
public class SellBackDetail {

	private int id;
	private int quantity;
	private SellBackMain sellBackMain;
	private Commodity commodity;
	
	public SellBackDetail(){
		
	}
	
	@Id
	@Column(name="sell_back_detail_id")
	@GeneratedValue
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getQuantity() {
		return quantity;
	}
	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	@ManyToOne(cascade={CascadeType.ALL},fetch=FetchType.EAGER)
	@JoinColumn(name="sell_back_main_id")
	public SellBackMain getSellBackMain() {
		return sellBackMain;
	}
	public void setSellBackMain(SellBackMain sellBackMain) {
		this.sellBackMain = sellBackMain;
	}
	@OneToOne(cascade={CascadeType.ALL},fetch=FetchType.EAGER)
	@JoinColumn(name="commodity_id")
	public Commodity getCommodity() {
		return commodity;
	}
	public void setCommodity(Commodity commodity) {
		this.commodity = commodity;
	}
}
